#coding:utf-8

import datetime
import os
import json

def _now():
	now = datetime.datetime.now()
	return now.strftime('%Y_%m_%d')	

class RssData(object):

	def __init__(self, root):
		self.root = root
		if not os.path.exists(root):
			os.mkdir(root)

	def insert(self, ns):
		filename = _now()
		filename = os.path.join(self.root,filename)
		with open(filename,mode='a') as f:
			for n in ns:
				line = json.dumps(n,ensure_ascii=False)
				f.write(line.encode('utf-8')+'\n')


